using System;
using System.Collections;
using System.Configuration;
using Copperline.Escriba;
using Copperline.Escriba.Config;
using System.Diagnostics;

namespace EscribaTest
{
	/// <summary>
	/// Summary description for ConsoleApp.
	/// </summary>
	class ConsoleApp
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			ArrayList config = (ArrayList)ConfigurationSettings.GetConfig("escriba");
			Logger.Debug("Debug message");
			Logger.Info("Info message");
			Logger.Notice("Notice message");
			Logger.Warning("Warning message");
			Logger.Error("Error message");
			Logger.Fatal("Fatal message");
			foreach( UserLogger ul in config )
			{
				Logger.Debug("Configuration name="+ul.Name);
				Logger.Debug("Configuration type="+ul.Type);
				foreach( string key in ul.Properties.Keys )
				{
					Logger.Debug("Configuration parm["+key+"]="+ul.Properties[key]);
				}
			}
			string sDbConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dev\Copperline\Escriba\_database\EscribaLog.mdb;";
			Logger.AddLogger("DbLogger", new DbLogger( sDbConn, ESeverity.debug, ETrigger.threshold ) );
			foreach( string key in Logger.Keys )
			{
				Logger.Debug("Logger: " + key );
				ILogger logger = Logger.GetLogger(key);
				if( logger.Fault )
				{
					Logger.Debug( logger.LastError );
				}
			}
		}
	}
}
